package com.svse.designPattern.behaviour.iterator.impl;

import com.svse.designPattern.behaviour.iterator.service.Aggregate;
import com.svse.designPattern.behaviour.iterator.service.Iterator;

import java.util.ArrayList;
import java.util.List;

/**
 * @author LiYuhang
 * @version 0.1
 * @application
 * @Date 2020/8/8 23:04
 */
public class ConcreteAggregate implements Aggregate {
    private List<Object> list=new ArrayList<Object>(10);
    @Override
    public void add(Object obj) {
        list.add(obj);
    }

    @Override
    public void remove(Object obj) {
        list.remove(obj);
    }

    @Override
    public Iterator getIterator() {
        return new ConcreteIterator(list);
    }
}
